masks = niftiread("masks.nii.gz");
masks = squeeze(masks(:,:,50,:));

mask = masks(:,:,1);

switch maskselection
    case 0 % full slice
        graymask = masks(:,:,4);
        whitemask = masks(:,:,5);
    case 1 % Gray Matter
        graymask = masks(:,:,4);
        whitemask = [];
    case 2 % White Matter
        graymask = [];
        whitemask = masks(:,:,5);
    case 3 % full slice without optical chiasm
        graymask = masks(:,:,4);
        whitemask = masks(:,:,6);
    case 4 % Gray Matter
        graymask = masks(:,:,4);
        whitemask = [];
    case 5 % White Matter without optical chiasm
        graymask = [];
        whitemask = masks(:,:,6);
end

disp(['Graymask has this many samples: ' num2str(sum(graymask(:)))]);
disp(['Whitemask has this many samples: ' num2str(sum(whitemask(:)))]);